{% extends "themes/silently/base.html" %}
{% load everfilters %}
{% block title %}{{ post.title }} - {{ site_title }}{% endblock %}
{% block nav %}
	<ul>
		<li><a href="{{ site_url }}">Home</a></li>
		{% for item in pages %} 
			{% ifequal item.id post.id %}
			<li class="active">
			{% endifequal %}
			{% ifnotequal item.id post.id %}
			<li>
			{% endifnotequal %}
			<a href="{{ site_url }}{{ post.date|date:"Y/m/" }}{% if post.slug %}{{ post.slug }}{% else %}{{ post.id }}{% endif %}/" title="{{ item.title }}">{{ item.title }}</a></li>
		{% endfor %}
	</ul>
{% endblock %}
{% block content %}
	<ol id="posts-list" class="body">
		<li>
			<article class="entry">
				<header>
					<h2 class="entry-title"><a href="{{ site_url }}{{ post.date|date:"Y/m/" }}{% if post.slug %}{{ post.slug }}{% else %}{{ post.id }}{% endif %}/" rel="bookmark">{{ post.title }}</a></h2>
				</header>
				<footer>
						wiboshu post on <time datetime="{{ post.date|date:"Y-m-d" }}">{{ post.date|date:"M d Y" }}</time>
						{% if post.tags.all %}
							|	tags：
							{% for tag in post.tags.all %}
							<a href="{{ site_url }}tag/{{ tag.id }}/" rel="tag">{{ tag.name }}</a>	
							{% endfor %}
						{% endif %}
				</footer>
				<div class="entry-content">
					{% autoescape off %}
						{{ post.content|replace_br }}
					{% endautoescape %}
				</div>
			</article>
		</li>
	</ol>
	<nav class="body">
		<ul>
    		{% if post_previous %}
				<li class="left"><a href="{{ site_url }}{{ post_previous.date|date:"Y/m/" }}{{ post_previous.id }}/" rel="prev">{{ post_previous.title}}</a></li>
			{% endif %}
        	{% if post_next %}
				<li class="right"><a href="{{ site_url }}{{ post_next.date|date:"Y/m/" }}{{ post_next.id }}/">{{ post_next.title }}</a></li>
			{% endif %}
		</ul>
	</nav>
	<section id="comments">
		<header>
			<h2>Comments</h2>
		</header>
		<ul class="comment-list">
			{% for item in comments %}
			<li>
				<article>
					<header>
					on {{ item.date|date:"M d Y h:m" }}{% if item.author_url %} <a href="{{ item.author_url }}">{{ item.author }}</a> {% else %} {{ item.author }} {% endif %}says:
					</header>
					<div>{{ item.content }}</div>
				</article>
			</li>
			{% endfor %}
		</ul>
	</section>
	<section id="add-comment">
		<header>
			<h2>Leave a Comment</h2>
		</header>
		<div>
			{%if form.errors %}
				<p style="color:red;">
					Please correct the error{{ form.errors|pluralize }} below.
				</p>
			{% endif %}
	
			<form action="{{ site_url }}{{ post.date|date:"Y/m/" }}{% if post.slug %}{{ post.slug }}{% else %}{{ post.id }}{% endif %}/" method="post">
				<ul>
					<li><label for="id_name">Name:</label>{{ form.name }}{{ form.name.errors|removetags:"li" }}</li>
					<li><label for="id_email">E-mail:</label>{{ form.email }}{{ form.email.errors|removetags:"li" }}</li>
					<li><label for="id_website">Website:</label>{{ form.website }}{{ form.website.errors|removetags:"li" }}</li>
					<li><label for="id_content">Some words:</label>{{ form.content }}{{ form.content.errors|removetags:"li" }}<li>
					<li><label for="id_submit"></label><input type="submit" value="Submit Comment"></li>
				</ul>
			</form>
		</div>
	</section>
{% endblock %}
